const db = require('../common/mongoose'),
  mongoose = db.mongoose,
  Schema = db.Schema;

let postSchema = new Schema({
  // 标题
  title: {type: String, },
  // 文章别名
  alias: {type: String, },
  // 摘要
  summary: {type: String, },
  // 来源
  source: {type: String, },
  // 内容
  content: {type: String, },
  // 分类Id
  categoryId: {
    type: String,
    ref: 'Category'
  },
  // 标签
  labels: [{
    type: String
  }],
  // 外链Url
  url: {type: String, },
  // 浏览次数
  viewCount: {type: Number, default:0},
  // 是否是私密文章
  isSecret: {type: Boolean, },
  // 是否草稿
  isDraft: {type: Boolean, },
  // 创建时间
  createTime: {type: Date, default: Date.now},
  // 修改时间
  updateTime: {type: Date, default: Date.now},
  deleteTime: {type: Date},
  // 删除时间
  // 操作人
  operator: {type: String, },
  // 操作人id
  operatorId: {type: String, },
  // 备注
  remarks: {type: String, }
});

let PostModel = mongoose.model('Post', postSchema, 'post');

module.exports = PostModel;